package main

import (
	"fmt"
	"reflect"
	"sync"
	"time"
)

const (
	TypicalNoob           int = iota // 0
	TypicalHipster                   // 1
	TypicalUnixWizard                // 2
	TypicalStartupFounder            // 3
)

func main() {

	t1()
}

func t1() {
	i := 1
	fmt.Println(reflect.ValueOf(&i).Type().Kind())
	a := []int{1, 2}
	fmt.Println(reflect.ValueOf(a).Type().Elem())
	fmt.Println(reflect.ValueOf(&i).Elem().Type())
}

//sync.Mutex 可以消除临界区的竞态
//go run -race main.go
func raceTest() {
	var count = 0
	mux := sync.Mutex{}

	for i := 0; i < 10; i++ {
		go func() {
			mux.Lock()
			defer mux.Unlock()
			count++
		}()
	}
	time.Sleep(time.Second * 1)
}
